/**
 * desc：把一个标准的html转为markdown的loader
 * author：王文军
 * date：  2022/3/20 18:25
 */
const utils = require('loader-utils')
const TurndownService = require('turndown')
function markdownHTMLLoader(source) {
  console.log(source);
  const options = utils.getOptions(this);
  const turndownService = new TurndownService(options)
  const markdown = turndownService.turndown(source);
  return code = `module.exports = ${JSON.stringify(markdown)}`
}
module.exports = markdownHTMLLoader
